﻿
$(function () {

    $('#PoliceRoleDataGrid').datagrid({
        url: '/System/LoadPoliceList',
        fitColumns: true,
        rownumbers: true,
        pagination: true,
        pageNumber: 1,
        pageSize: 20,
        nowrap: false,
        idField: 'Id',
        toolbar: '#policeroleToolbar',
        singleSelect: true,
        columns: [[
               { title: 'Id', field: 'Id', align: 'center', width: 10, hidden: true },
               { title: '姓名', field: 'Name', align: 'left', width: 100 },
               { title: '警号', field: 'Code', align: 'left', width: 100 },
               { title: '所属单位', field: 'OrganizationName', align: 'left', width: 80 },
               { title: '性别', field: 'Sex', align: 'left', width: 80 },
               { title: '身份证号码', field: 'IDCard', align: 'left', width: 150 }
        ]]
    });
});



function btnSaveOrUpdatePoliceRoleAction() {
    try {

        var row = $("#PoliceRoleDataGrid").datagrid("getSelected");
        var policeId = 0;
        var policeName;
        if (row) {
            policeId = row.Id;
            policeName = row.Name;
        } else {
            $.messager.alert("操作提示", "请选择需要分配角色的警员！", "error");
            return;
        }

        var PoliceRoleViewDlg = art.dialog({
            id: "diaForPoliceRoleView",
            title: policeName + '  角色分配',
            content: "<iframe name='diaForRole' scrolling='yes' frameborder='0' src='/System/RoleListView?policeId=" + policeId + "' style='width:510px;height:300px;'/>",
            lock: true,
            initFn: function () {
            }
        });
    } catch (ex) {
        alert(ex);
    }
};
function btnSearchPoliceRoleListAction() {
    var code = $("#txtPoliceCode").val();
    var name = $("#txtPoliceName").val();
    var station = $("#txtPoliceStation").val();
    $('#PoliceRoleDataGrid').datagrid("reload", { "PoliceCode": code, "PoliceName": name, "PoliceStation": station });
};